//
//  HoneHeadView.m
//  LPTClient
//
//  Created by mac on 2018/12/4.
//  Copyright © 2018年 zhaodd. All rights reserved.
//

#import "HoneHeadView.h"
#import <SDCycleScrollView/SDCycleScrollView.h>

@interface HoneHeadView ()<SDCycleScrollViewDelegate>

@property (strong, nonatomic) SDCycleScrollView *cycleScrollView;

@end

@implementation HoneHeadView

+(HoneHeadView *)headView
{
    HoneHeadView *head = [[[NSBundle mainBundle] loadNibNamed:@"HoneHeadView" owner:self options:nil] lastObject];
    return head;
}

-(void)awakeFromNib
{
    [super awakeFromNib];
    
    [self initSubViews];
}

-(void)initSubViews
{
    SDCycleScrollView *cycleScrollView  = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(10, 10,kScreenWidth - 20 , 112 + 37) delegate:self placeholderImage:nil];
    cycleScrollView.infiniteLoop = YES;
    cycleScrollView.autoScroll = YES;
    [self addSubview:cycleScrollView];
    self.cycleScrollView = cycleScrollView;
}

-(void)refreshWithImageList:(NSArray *)array
{
    self.cycleScrollView.imageURLStringsGroup = array;
}

- (IBAction)firstItemAction:(UIButton *)sender {
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(honeHeadView:didClickAtIndex:)]) {
        [self.delegate honeHeadView:self didClickAtIndex:0];
    }
    
}

- (IBAction)secondItemAction:(UIButton *)sender {
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(honeHeadView:didClickAtIndex:)]) {
        [self.delegate honeHeadView:self didClickAtIndex:1];
    }
}

- (IBAction)thirdItemAction:(UIButton *)sender {
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(honeHeadView:didClickAtIndex:)]) {
        [self.delegate honeHeadView:self didClickAtIndex:2];
    }
}

- (IBAction)fourthItemAction:(UIButton *)sender {
    
    if (self.delegate && [self.delegate respondsToSelector:@selector(honeHeadView:didClickAtIndex:)]) {
        [self.delegate honeHeadView:self didClickAtIndex:3];
    }
}


@end
